<template>
	<el-container>
		<el-header>
			<div class="left-panel">
				<el-button type="primary" @click="add" icon="el-icon-plus"></el-button>
				<el-button type="danger" plain icon="el-icon-delete"></el-button>
			</div>
			<div class="right-panel">
				<div class="right-panel-search">
					<el-input v-model="search.keyword" placeholder="关键词" clearable></el-input>
					<el-button type="primary" icon="el-icon-search" @click="upsearch"></el-button>
				</div>
			</div>
		</el-header>
		<el-main class="nopadding">
			<scTable ref="table" :apiObj="apiObj" row-key="uuid" stripe>
				<el-table-column type="selection" width="50"></el-table-column>
				<el-table-column label="用户名" prop="username" width="150"></el-table-column>
				<el-table-column label="用户类型" prop="openType" width="150"></el-table-column>
				<el-table-column label="昵称" prop="nickname" width="150"></el-table-column>
				<el-table-column label="性别" prop="sex" width="150"></el-table-column>
				<el-table-column label="邮箱" prop="eMail" width="250"></el-table-column>
				<el-table-column label="用户手机号" prop="mobile" width="150"></el-table-column>
				<el-table-column label="注册时间" prop="createtime" width="150" sortable></el-table-column>
				<el-table-column label="操作" fixed="right" align="right" width="160">
					<template #default>
						<el-button-group>
							<el-button text type="primary" size="small">查看</el-button>
							<el-button text type="primary" size="small">编辑</el-button>
							<el-button text type="primary" size="small">删除</el-button>
						</el-button-group>
					</template>
				</el-table-column>
			</scTable>
		</el-main>
	</el-container>

    <save-dialog v-if="dialog.save" ref="saveDialog" @success="handleSuccess" @closed="dialog.save=false"></save-dialog>

</template>

<script>
	import saveDialog from './save'
	import scSelectFilter from '@/components/scSelectFilter'

	export default {
		name: 'listTab',
		components: {
			scSelectFilter,
            saveDialog
		},
		data() {
			return {
                dialog:{
                    save:false
                },
				groupId: "0",
				apiObj: this.$API.openuser.page,
				search: {
					keyword: ""
				}
			}
		},
		methods: {
            add(){
                this.dialog.save=true;
                this.$nextTick(() => {
					this.$refs.saveDialog.open()
				})
            },
            handleSuccess(){
                
            },
			//搜索
			upsearch(){
				this.$refs.table.upData(this.search)
			},
			//标签切换
			tabChange(name){
				var params = {
					groupId: name
				}
				this.$refs.table.reload(params)
			},
			filterChange(data){
				this.$refs.table.upData(data)
			}
		}
	}
</script>

<style>
</style>
